styleproperties: Use the pspec as the hash table key
authorBenjamin Otte <otte@redhat.com>
Mon, 16 May 2011 20:22:42 +0000 (22:22 +0200)
committerBenjamin Otte <otte@redhat.com>
Wed, 18 May 2011 20:17:57 +0000 (22:17 +0200)
The code used the quarked name before, but when we already have the
pspec we want to have a lookup that does not involve quarking. And
lookup is equally fast if we only have the name.

gtk/gtkstyleproperties.c

index dc615d24a8112a652356bb28fe4c6b57d81002f4..2bb8f5a6d57dbf85ae8bdd1156fa3baec63e7536 100644 (file)
@@ -708,15 +708,12 @@ gtk_style_properties_set_property (GtkStyleProperties *props,
     g_return_if_fail (node->pspec->value_type == value_type);
 
   priv = props->priv;
-  prop = g_hash_table_lookup (priv->properties,
-                              GINT_TO_POINTER (node->property_quark));
+  prop = g_hash_table_lookup (priv->properties, node->pspec);
 
   if (!prop)
     {
       prop = property_data_new ();
-      g_hash_table_insert (priv->properties,
-                           GINT_TO_POINTER (node->property_quark),
-                           prop);
+      g_hash_table_insert (priv->properties, node->pspec, prop);
     }
 
   val = property_data_get_value (prop, state);
@@ -772,15 +769,12 @@ gtk_style_properties_set_valist (GtkStyleProperties *props,
           break;
         }
 
-      prop = g_hash_table_lookup (priv->properties,
-                                  GINT_TO_POINTER (node->property_quark));
+      prop = g_hash_table_lookup (priv->properties, node->pspec);
 
       if (!prop)
         {
           prop = property_data_new ();
-          g_hash_table_insert (priv->properties,
-                               GINT_TO_POINTER (node->property_quark),
-                               prop);
+          g_hash_table_insert (priv->properties, node->pspec, prop);
         }
 
       val = property_data_get_value (prop, state);
@@ -957,8 +951,7 @@ _gtk_style_properties_peek_property (GtkStyleProperties *props,
     }
 
   priv = props->priv;
-  prop = g_hash_table_lookup (priv->properties,
-                              GINT_TO_POINTER (node->property_quark));
+  prop = g_hash_table_lookup (priv->properties, node->pspec);
 
   if (!prop)
     return NULL;
@@ -1010,8 +1003,7 @@ gtk_style_properties_get_property (GtkStyleProperties *props,
     }
 
   priv = props->priv;
-  prop = g_hash_table_lookup (priv->properties,
-                              GINT_TO_POINTER (node->property_quark));
+  prop = g_hash_table_lookup (priv->properties, node->pspec);
 
   if (!prop)
     return FALSE;
@@ -1072,8 +1064,7 @@ gtk_style_properties_get_valist (GtkStyleProperties *props,
           break;
         }
 
-      prop = g_hash_table_lookup (priv->properties,
-                                  GINT_TO_POINTER (node->property_quark));
+      prop = g_hash_table_lookup (priv->properties, node->pspec);
 
       if (prop)
         val = property_data_match_state (prop, state);
@@ -1165,8 +1156,7 @@ gtk_style_properties_unset_property (GtkStyleProperties *props,
     }
 
   priv = props->priv;
-  prop = g_hash_table_lookup (priv->properties,
-                              GINT_TO_POINTER (node->property_quark));
+  prop = g_hash_table_lookup (priv->properties, node->pspec);
 
   if (!prop)
     return;